#include <iostream>
#include <string>
#include <time.h>
#include <thread>

#include "libmyutil/myutil.h"

using namespace std;
int RingbufferTest(int size, int read_size) {
    myutil::RingBuffer ringBuffer(size);

    printf("please input:\n");

    string input;
    while (1)
    {
        std::getline(std::cin, input);
        if (input == "q") {
            break;
        }
        else if (input == "r"){
            string buf = ringBuffer.read(read_size);
            printf("ringBuffer.read() : %s\n", buf.c_str());
            ringBuffer.print();
        }
        else {
            ringBuffer.write((unsigned char*)input.c_str(), input.size());
            ringBuffer.print();
        }
    }

    return 0;
}